
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>读取HDF或者NetCDF格式的栅格数据 · GitBook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        
        
        
    
    <link rel="stylesheet" href="../../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="栅格数据投影转换.html" />
    
    
    <link rel="prev" href="栅格数据创建与保存.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../../">
            
                <a href="../../">
            
                    
                    前言
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../../Python基础/">
            
                <a href="../../Python基础/">
            
                    
                    Python基础
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="../../Python基础/Python环境搭建及基本数据类型.html">
            
                <a href="../../Python基础/Python环境搭建及基本数据类型.html">
            
                    
                    Python环境搭建及基本数据类型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="../../Python基础/运算符及字符串.html">
            
                <a href="../../Python基础/运算符及字符串.html">
            
                    
                    运算符及字符串
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="../../Python基础/序列与字典.html">
            
                <a href="../../Python基础/序列与字典.html">
            
                    
                    序列与字典
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.4" data-path="../../Python基础/流程控制语句.html">
            
                <a href="../../Python基础/流程控制语句.html">
            
                    
                    流程控制语句
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.5" data-path="../../Python基础/函数.html">
            
                <a href="../../Python基础/函数.html">
            
                    
                    函数
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.6" data-path="../../Python基础/面向对象编程初识.html">
            
                <a href="../../Python基础/面向对象编程初识.html">
            
                    
                    面向对象编程初识
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.7" data-path="../../Python基础/面向对象编程高级.html">
            
                <a href="../../Python基础/面向对象编程高级.html">
            
                    
                    面向对象编程高级
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.8" data-path="../../Python基础/Python科学计算.html">
            
                <a href="../../Python基础/Python科学计算.html">
            
                    
                    Python科学计算
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.9" data-path="../../Python基础/空间数据处理环境搭建.html">
            
                <a href="../../Python基础/空间数据处理环境搭建.html">
            
                    
                    空间数据处理环境搭建
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="../../空间数据基础/">
            
                <a href="../../空间数据基础/">
            
                    
                    空间数据基础
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="../../空间数据基础/空间参考系统.html">
            
                <a href="../../空间数据基础/空间参考系统.html">
            
                    
                    空间参考系统
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="../../空间数据基础/地图投影.html">
            
                <a href="../../空间数据基础/地图投影.html">
            
                    
                    地图投影
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3" data-path="../../空间数据基础/空间数据.html">
            
                <a href="../../空间数据基础/空间数据.html">
            
                    
                    空间数据
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="../">
            
                <a href="../">
            
                    
                    GDAL空间数据处理
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="../GDAL简介.html">
            
                <a href="../GDAL简介.html">
            
                    
                    GDAL简介
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="../GDAL数据基本操作.html">
            
                <a href="../GDAL数据基本操作.html">
            
                    
                    GDAL数据基本操作
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.2.1" data-path="打开栅格数据的正确方式.html">
            
                <a href="打开栅格数据的正确方式.html">
            
                    
                    打开栅格数据的正确方式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2.2" data-path="栅格数据格式转换.html">
            
                <a href="栅格数据格式转换.html">
            
                    
                    栅格数据格式转换
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2.3" data-path="栅格数据创建与保存.html">
            
                <a href="栅格数据创建与保存.html">
            
                    
                    栅格数据创建与保存
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.4.2.4" data-path="读取HDF或者NetCDF格式的栅格数据.html">
            
                <a href="读取HDF或者NetCDF格式的栅格数据.html">
            
                    
                    读取HDF或者NetCDF格式的栅格数据
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2.5" data-path="栅格数据投影转换.html">
            
                <a href="栅格数据投影转换.html">
            
                    
                    栅格数据投影转换
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2.6" data-path="栅格数据裁剪.html">
            
                <a href="栅格数据裁剪.html">
            
                    
                    栅格数据裁剪
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2.7" data-path="打开Shapefile文件的正确方式.html">
            
                <a href="打开Shapefile文件的正确方式.html">
            
                    
                    打开Shapefile文件的正确方式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2.8" data-path="创建Shapefile文件并写入数据.html">
            
                <a href="创建Shapefile文件并写入数据.html">
            
                    
                    创建Shapefile文件并写入数据
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2.9" data-path="矢量数据投影转换.html">
            
                <a href="矢量数据投影转换.html">
            
                    
                    矢量数据投影转换
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4.3" data-path="../Fiona矢量数据处理/REDAME.md">
            
                <span>
            
                    
                    Fiona矢量数据处理
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.3.1" data-path="../Fiona矢量数据处理/Fiona简介及Shapefile数据读取.html">
            
                <a href="../Fiona矢量数据处理/Fiona简介及Shapefile数据读取.html">
            
                    
                    Fiona简介及Shapefile数据读取
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3.2" data-path="../Fiona矢量数据处理/使用Fiona创建Shapefile矢量数据.html">
            
                <a href="../Fiona矢量数据处理/使用Fiona创建Shapefile矢量数据.html">
            
                    
                    使用Fiona创建Shapefile矢量数据
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4.4" data-path="../Rasterio栅格数据处理/README.md">
            
                <span>
            
                    
                    Rasterio栅格数据处理
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.4.1" data-path="../Rasterio栅格数据处理/使用Rasterio读取栅格数据.html">
            
                <a href="../Rasterio栅格数据处理/使用Rasterio读取栅格数据.html">
            
                    
                    使用Rasterio读取栅格数据
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4.2" data-path="../Rasterio栅格数据处理/使用Rasterio创建栅格数据.html">
            
                <a href="../Rasterio栅格数据处理/使用Rasterio创建栅格数据.html">
            
                    
                    使用Rasterio创建栅格数据
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4.3" data-path="../Rasterio栅格数据处理/使用Rasterio做投影变换.html">
            
                <a href="../Rasterio栅格数据处理/使用Rasterio做投影变换.html">
            
                    
                    使用Rasterio做投影变换
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../.." >读取HDF或者NetCDF格式的栅格数据</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="&#x8BFB;&#x53D6;hdf&#x6216;&#x8005;netcdf&#x683C;&#x5F0F;&#x7684;&#x6805;&#x683C;&#x6570;&#x636E;">&#x8BFB;&#x53D6;HDF&#x6216;&#x8005;NetCDF&#x683C;&#x5F0F;&#x7684;&#x6805;&#x683C;&#x6570;&#x636E;</h1>
<p>&#x4F5C;&#x8005;&#xFF1A;&#x963F;&#x632F;</p>
<p>&#x90AE;&#x7BB1;&#xFF1A;tanzhenyugis@163.com</p>
<p>&#x535A;&#x5BA2;&#xFF1A;<a href="https://blog.csdn.net/theonegis/article/details/80089375" target="_blank">https://blog.csdn.net/theonegis/article/details/80089375</a></p>
<p>&#x4FEE;&#x6539;&#x65F6;&#x95F4;&#xFF1A;2018-05-17</p>
<p>&#x58F0;&#x660E;&#xFF1A;&#x672C;&#x6587;&#x4E3A;&#x535A;&#x4E3B;&#x539F;&#x521B;&#x6587;&#x7AE0;&#xFF0C;&#x8F6C;&#x8F7D;&#x8BF7;&#x6CE8;&#x660E;&#x539F;&#x6587;&#x51FA;&#x5904;</p>
<hr>
<h2 id="hdf&#x548C;netcdf&#x7B80;&#x4ECB;">HDF&#x548C;NetCDF&#x7B80;&#x4ECB;</h2>
<h3 id="hdf">HDF</h3>
<p>HDF&#xFF08;Hierarchical Data Format&#xFF09;&#x7531;NCSA&#xFF08;National Center for Supercomputing Applications&#xFF09;&#x8BBE;&#x8BA1;&#x63D0;&#x51FA;&#xFF0C;&#x5B98;&#x65B9;&#x5BF9;&#x5176;&#x5B9A;&#x4E49;&#x662F;&#xFF1A;HDF5 is a unique technology suite that makes possible the management of extremely large and complex data collections.</p>
<p>HDF supports n-dimensional datasets and each element in the dataset may itself be a complex object.</p>
<p>HDF&#x662F;&#x5BF9;HDF&#x6570;&#x636E;&#x6A21;&#x578B;&#xFF0C;&#x6570;&#x636E;&#x683C;&#x5F0F;&#x4EE5;&#x53CA;HDF&#x5E93;API&#x7B49;&#x4E00;&#x7CFB;&#x5217;&#x6280;&#x672F;&#x7684;&#x603B;&#x79F0;. HDF&#x7684;&#x6700;&#x65B0;&#x7248;&#x672C;&#x662F;HDF5.</p>
<p>HDF&#x6570;&#x636E;&#x6A21;&#x578B;&#x57FA;&#x4E8E;&#x7EC4;&#xFF08;groups&#xFF09;&#x548C;&#x6570;&#x636E;&#x96C6;&#xFF08;datasets&#xFF09;&#x6982;&#x5FF5;&#xFF1A;&#x5982;&#x679C;&#x628A;HDF&#x6570;&#x636E;&#x6BD4;&#x4F5C;&#x78C1;&#x76D8;&#xFF0C;&#x90A3;&#x4E48;&#x7EC4;&#x76F8;&#x5F53;&#x4E8E;&#x6587;&#x4EF6;&#x5939;&#xFF0C;&#x6570;&#x636E;&#x96C6;&#x76F8;&#x5F53;&#x4E8E;&#x6587;&#x4EF6;&#x3002;&#x7EC4;&#x548C;&#x6570;&#x636E;&#x96C6;&#x90FD;&#x6709;&#x7528;&#x6237;&#x81EA;&#x5B9A;&#x4E49;&#x7684;&#x5C5E;&#x6027;&#xFF08;attributes&#xFF09;.</p>
<p>MODIS&#x5F71;&#x50CF;&#xFF0C;&#x4EE5;&#x53CA;&#x6211;&#x56FD;&#x7684;&#x98CE;&#x4E91;&#x536B;&#x661F;&#x6570;&#x636E;&#x90FD;&#x9002;&#x7528;HDF&#x683C;&#x5F0F;&#x8FDB;&#x884C;&#x5B58;&#x50A8;.</p>
<h3 id="netcdf">NetCDF</h3>
<p>NetCDF&#xFF08;Network Common Data Format&#xFF09;&#x7531;UCAR&#xFF08;University Corporation for Atmospheric Research&#xFF09;&#x8BBE;&#x8BA1;&#x63D0;&#x51FA;&#xFF0C;&#x5176;&#x5B98;&#x65B9;&#x7684;&#x5B9A;&#x4E49;&#x662F;&#xFF1A;NetCDF is a set of software libraries and self-describing, machine-independent data formats that support the creation, access, and sharing of array-oriented scientific data.</p>
<p>NetCDF&#x662F;&#x9762;&#x5411;&#x591A;&#x7EF4;&#x6570;&#x7EC4;&#x7684;&#x6570;&#x636E;&#x96C6;&#xFF0C;&#x4E00;&#x4E2A;NetCDF&#x6587;&#x4EF6;&#x4E3B;&#x8981;&#x662F;Dimensions, Variables, Attributes, Data &#x56DB;&#x4E2A;&#x90E8;&#x5206;&#x7EC4;&#x6210;&#x7684;&#xFF1A;</p>
<ul>
<li>Dimension&#x4E3B;&#x8981;&#x662F;&#x5BF9;&#x7EF4;&#x5EA6;&#x7684;&#x5B9A;&#x4E49;&#x8BF4;&#x660E;&#xFF0C;&#x4F8B;&#x5982;&#xFF1A;&#x7ECF;&#x5EA6;&#xFF0C;&#x7EF4;&#x5EA6;&#xFF0C;&#x65F6;&#x95F4;&#x7B49;&#xFF1B;</li>
<li>Variables&#x662F;&#x5BF9;&#x6570;&#x636E;&#x8868;&#x793A;&#x7684;&#x73B0;&#x8C61;&#x7684;&#x8BF4;&#x660E;&#xFF0C;&#x4F8B;&#x5982;&#xFF1A;&#x6E29;&#x5EA6;&#xFF0C;&#x6E7F;&#x5EA6;&#xFF0C;&#x9AD8;&#x7A0B;&#x7B49;&#xFF1B;</li>
<li>Attributes&#x662F;&#x4E00;&#x4E9B;&#x8F85;&#x52A9;&#x7684;&#x5143;&#x4FE1;&#x606F;&#x8BF4;&#x660E;&#xFF0C;&#x4F8B;&#x5982;&#x53D8;&#x91CF;&#x7684;&#x5355;&#x4F4D;&#x7B49;&#xFF1B;</li>
<li>Data&#x662F;&#x4E3B;&#x8981;&#x5BF9;&#x73B0;&#x8C61;&#x7684;&#x89C2;&#x6D4B;&#x6570;&#x636E;&#x96C6;&#x3002;</li>
</ul>
<p>NetCDF&#x6709;&#x4E24;&#x4E2A;&#x6570;&#x636E;&#x6A21;&#x578B;&#xFF1A;&#x7ECF;&#x5178;&#x6A21;&#x578B;&#xFF08;NetCDF3&#x4E4B;&#x524D;&#x6A21;&#x578B;&#xFF09;&#x548C;&#x589E;&#x5F3A;&#x6A21;&#x578B;&#xFF08;NetCDF4&#xFF09;</p>
<p>NetCDF&#x6700;&#x65B0;&#x7248;&#x672C;&#x662F;NetCDF4&#xFF0C;NetCDF4&#x7684;API&#x63A5;&#x53E3;&#x5EFA;&#x7ACB;&#x5728;HDF5&#x4E4B;&#x4E0A;&#xFF0C;&#x548C;HDF5&#x662F;&#x517C;&#x5BB9;&#x7684;.</p>
<p>&#x5982;&#x679C;&#x641E;&#x5927;&#x6C14;&#x7814;&#x7A76;&#x7684;&#x540C;&#x5B66;&#x4E00;&#x5B9A;&#x5BF9;NetCDF&#x683C;&#x5F0F;&#x4E0D;&#x964C;&#x751F;&#xFF0C;&#x63A5;&#x89E6;&#x5230;&#x7684;&#x5927;&#x90E8;&#x5206;&#x6570;&#x636E;&#x90FD;&#x662F;&#x8FD9;&#x79CD;&#x683C;&#x5F0F;.</p>
<h2 id="hdf&#x548C;netcdf&#x6805;&#x683C;&#x6570;&#x636E;&#x96C6;&#x7279;&#x70B9;">HDF&#x548C;NetCDF&#x6805;&#x683C;&#x6570;&#x636E;&#x96C6;&#x7279;&#x70B9;</h2>
<p>HDF&#x548C;NetCDF&#x6570;&#x636E;&#x90FD;&#x53EF;&#x80FD;&#x5305;&#x542B;&#x6570;&#x636E;&#x5B50;&#x96C6;&#xFF08;&#x4E00;&#x4E2A;&#x6587;&#x4EF6;&#x4E2D;&#x5305;&#x542B;&#x591A;&#x4E2A;&#x5B50;&#x6587;&#x4EF6;&#xFF09;&#xFF0C;&#x6211;&#x4EEC;&#x9700;&#x8981;&#x627E;&#x51FA;&#x9700;&#x8981;&#x7684;&#x5B50;&#x96C6;&#x6570;&#x636E;&#xFF0C;&#x7136;&#x540E;&#x5C31;&#x53EF;&#x4EE5;&#x50CF;&#x666E;&#x901A;&#x7684;GeoTIFF&#x5F71;&#x50CF;&#x90A3;&#x6837;&#x8FDB;&#x884C;&#x8BFB;&#x5199;&#x548C;&#x64CD;&#x4F5C;&#x4E86;.</p>
<h2 id="gdal&#x8BFB;&#x53D6;&#x5B9E;&#x4F8B;">GDAL&#x8BFB;&#x53D6;&#x5B9E;&#x4F8B;</h2>
<p>&#x4E0B;&#x9762;&#x7684;&#x4F8B;&#x5B50;&#x8BFB;&#x53D6;MODIS&#x5730;&#x6807;&#x53CD;&#x5C04;&#x7387;&#xFF08;Surface Reflectance&#xFF09;&#x6570;&#x636E;&#x4E2D;&#x7684;&#x7B2C;&#x4E00;&#x6CE2;&#x6BB5;&#xFF0C;&#x7136;&#x540E;&#x8F6C;&#x4E3A;GeoTIFF&#x8FDB;&#x884C;&#x5B58;&#x50A8;.</p>
<p>&#x6211;&#x4EEC;&#x9996;&#x5148;&#x4F7F;&#x7528;<code>gdal.Open()</code>&#x51FD;&#x6570;&#x8BFB;&#x53D6;HDF&#x6570;&#x636E;&#xFF0C;&#x7136;&#x540E;&#x4F7F;&#x7528;<code>GetSubDatasets()</code>&#x65B9;&#x6CD5;&#x53D6;&#x51FA;HDF&#x6570;&#x636E;&#x4E2D;&#x5B58;&#x50A8;&#x7684;&#x5B50;&#x6570;&#x636E;&#x96C6;&#x4FE1;&#x606F;&#xFF0C;&#x8BE5;&#x65B9;&#x6CD5;&#x8FD4;&#x56DE;&#x7684;&#x7ED3;&#x679C;&#x662F;&#x4E00;&#x4E2A;<code>list</code>&#xFF0C;<code>list</code>&#x7684;&#x6BCF;&#x4E2A;&#x5143;&#x7D20;&#x662F;&#x4E00;&#x4E2A;<code>tuple</code>&#xFF0C;&#x6BCF;&#x4E2A;<code>tuple</code>&#x4E2D;&#x5305;&#x542B;&#x4E86;&#x5BF9;&#x5B50;&#x6570;&#x636E;&#x96C6;&#x7684;&#x8868;&#x8FF0;&#x4FE1;&#x606F;.</p>
<p>&#x5BF9;&#x4E8E;MODIS&#x6570;&#x636E;&#xFF0C;<code>tuple</code>&#x7684;&#x7B2C;&#x4E00;&#x4E2A;&#x5143;&#x7D20;&#x662F;&#x5B50;&#x6570;&#x636E;&#x96C6;&#x7684;&#x5B8C;&#x6574;&#x8DEF;&#x5F84;&#xFF0C;&#x6240;&#x4EE5;&#x6211;&#x4EEC;&#x53D6;&#x51FA;&#x8BE5;&#x8DEF;&#x5F84;&#xFF0C;&#x7136;&#x540E;&#x4F7F;&#x7528;<code>gdal.Open()</code>&#x51FD;&#x6570;&#x8BFB;&#x53D6;&#x8BE5;&#x5B50;&#x6570;&#x636E;&#x96C6;.</p>
<p>&#x6700;&#x540E;&#x6211;&#x4EEC;&#x4F7F;&#x7528;<code>CreateCopy()</code>&#x65B9;&#x6CD5;&#x5C06;&#x8BE5;&#x5B50;&#x6570;&#x636E;&#x96C6;&#x5B58;&#x50A8;&#x4E3A;GeoTIFF&#x683C;&#x5F0F;&#x7684;&#x6570;&#x636E;&#x3002;</p>
<p>&#x6240;&#x4EE5;&#xFF0C;&#x603B;&#x7ED3;&#x4E00;&#x4E0B;&#xFF0C;&#x6211;&#x4EEC;&#x8BFB;&#x53D6;HDF&#x6216;&#x8005;NetCDF&#x6570;&#x636E;&#x5B50;&#x96C6;&#x7684;&#x65F6;&#x5019;&#xFF0C;&#x6700;&#x4E3B;&#x8981;&#x7684;&#x662F;&#x53D6;&#x51FA;&#x60F3;&#x8981;&#x5904;&#x7406;&#x7684;&#x5B50;&#x6570;&#x636E;&#x96C6;&#x7684;&#x5B8C;&#x6574;&#x8DEF;&#x5F84;&#x3002;&#x7136;&#x540E;&#x5C31;&#x50CF;&#x8BFB;&#x53D6;&#x666E;&#x901A;GeoTIFF&#x5F71;&#x50CF;&#x90A3;&#x6837;&#x5BF9;&#x5B50;&#x6570;&#x636E;&#x96C6;&#x8FDB;&#x884C;&#x8BFB;&#x53D6;&#x5C31;OK&#x4E86;.</p>
<pre><code class="lang-Python"><span class="hljs-keyword">from</span> osgeo <span class="hljs-keyword">import</span> gdal

root_ds = gdal.Open(<span class="hljs-string">&apos;example.hdf&apos;</span>)
<span class="hljs-comment"># &#x8FD4;&#x56DE;&#x7ED3;&#x679C;&#x662F;&#x4E00;&#x4E2A;list&#xFF0C;list&#x4E2D;&#x7684;&#x6BCF;&#x4E2A;&#x5143;&#x7D20;&#x662F;&#x4E00;&#x4E2A;tuple&#xFF0C;&#x6BCF;&#x4E2A;tuple&#x4E2D;&#x5305;&#x542B;&#x4E86;&#x5BF9;&#x6570;&#x636E;&#x96C6;&#x7684;&#x8DEF;&#x5F84;&#xFF0C;&#x5143;&#x6570;&#x636E;&#x7B49;&#x7684;&#x63CF;&#x8FF0;&#x4FE1;&#x606F;</span>
<span class="hljs-comment"># tuple&#x4E2D;&#x7684;&#x7B2C;&#x4E00;&#x4E2A;&#x5143;&#x7D20;&#x63CF;&#x8FF0;&#x7684;&#x662F;&#x6570;&#x636E;&#x5B50;&#x96C6;&#x7684;&#x5168;&#x8DEF;&#x5F84;</span>
ds_list = root_ds.GetSubDatasets()

band_1 = gdal.Open(ds_list[<span class="hljs-number">11</span>][<span class="hljs-number">0</span>])  <span class="hljs-comment"># &#x53D6;&#x51FA;&#x7B2C;12&#x4E2A;&#x6570;&#x636E;&#x5B50;&#x96C6;&#xFF08;MODIS&#x53CD;&#x5C04;&#x7387;&#x4EA7;&#x54C1;&#x7684;&#x7B2C;&#x4E00;&#x4E2A;&#x6CE2;&#x6BB5;&#xFF09;</span>
arr_bnd1 = band_1.ReadAsArray()  <span class="hljs-comment"># &#x5C06;&#x6570;&#x636E;&#x96C6;&#x4E2D;&#x7684;&#x6570;&#x636E;&#x8F6C;&#x4E3A;ndarray</span>

<span class="hljs-comment"># &#x521B;&#x5EFA;&#x8F93;&#x51FA;&#x6570;&#x636E;&#x96C6;&#xFF0C;&#x8F6C;&#x4E3A;GeoTIFF&#x8FDB;&#x884C;&#x5199;&#x5165;</span>
out_file = <span class="hljs-string">&apos;sr_band1.tif&apos;</span>
driver = gdal.GetDriverByName(<span class="hljs-string">&apos;GTiff&apos;</span>)
out_ds = driver.CreateCopy(out_file, band_1)
out_ds.GetRasterBand(<span class="hljs-number">1</span>).WriteArray(arr_bnd1)
out_ds.FlushCache()

<span class="hljs-comment"># &#x5173;&#x95ED;&#x6570;&#x636E;&#x96C6;</span>
out_ds = <span class="hljs-keyword">None</span>
root_ds = <span class="hljs-keyword">None</span>
</code></pre>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="栅格数据创建与保存.html" class="navigation navigation-prev " aria-label="Previous page: 栅格数据创建与保存">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="栅格数据投影转换.html" class="navigation navigation-next " aria-label="Next page: 栅格数据投影转换">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"读取HDF或者NetCDF格式的栅格数据","level":"1.4.2.4","depth":3,"next":{"title":"栅格数据投影转换","level":"1.4.2.5","depth":3,"path":"GDAL空间数据处理/GDAL数据基本操作/栅格数据投影转换.md","ref":"GDAL空间数据处理/GDAL数据基本操作/栅格数据投影转换.md","articles":[]},"previous":{"title":"栅格数据创建与保存","level":"1.4.2.3","depth":3,"path":"GDAL空间数据处理/GDAL数据基本操作/栅格数据创建与保存.md","ref":"GDAL空间数据处理/GDAL数据基本操作/栅格数据创建与保存.md","articles":[]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":[],"pluginsConfig":{"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"GDAL空间数据处理/GDAL数据基本操作/读取HDF或者NetCDF格式的栅格数据.md","mtime":"2019-03-22T18:52:30.714Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2019-03-22T20:04:12.549Z"},"basePath":"../..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../../gitbook/gitbook.js"></script>
    <script src="../../gitbook/theme.js"></script>
    
        
        <script src="../../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

